package com.uit.project.bustrip;

import java.util.ArrayList;

import com.uit.project.bustrip.adapter.ListPointAdapter;
import com.uit.project.bustrip.adapter.ListTripAdaper;
import com.uit.project.bustrip.bo.PointBOImpl;
import com.uit.project.bustrip.entity.Point;
import com.uit.project.bustrip.entity.Trip;

import android.os.Bundle;
import android.os.StrictMode;
import android.app.ListActivity;
import android.view.Menu;
import android.widget.ArrayAdapter;

public class ListPoint extends ListActivity {
	ArrayAdapter<Point> adapter;
	ArrayList<Point> items;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
		.permitAll().build();
		StrictMode.setThreadPolicy(policy);
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			int tripId = extras.getInt("tripID");
			PointBOImpl boImpl = new PointBOImpl(getApplicationContext());
			items = (ArrayList<Point>) boImpl.getAllPointByTripAsync(tripId);
			adapter = new ListPointAdapter(this,items);
			setListAdapter(adapter);
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.list_point, menu);
		return true;
	}

}
